#ifndef EDGE_H
#define EDGE_H

#include <QPointF>

//! Connecting nodes elements.
/*!
  EDGE is responsible for the elastic and contractile forces.
  */
struct EDGE
{
    explicit EDGE(void);

    //         .id3
    //
    // .id1 <--------> .id2
    //
    //            .id4

    //! Virtual area of the edge.
    /*!
      It is used for calculating kappa.
      Consists of areas of one (if edge is boundary) or two triangles id1-id2-O1 (and id1-id2-O2).
      O1 and O2 are bisector cross points for id1-id2-id3 and id1-id2-id4 triangles [meter^2].
      \sa kappa
      */
    double area;
    double currentArea;
    double defaultLength;  //!< Rest length of the corresponding elastic spring for the edge [meter].
    int id1;               //!< First node edge stretched on.
    int id2;               //!< Second node edge stretched on.
    int id3;               //!< Node vertex of triangle with edge as a one of the bounds. Always > 0.
    int id4;               //!< Node vertex of triangle with edge as a one of the bounds. Undefined for boundary edges.
    bool isBoundary;       //!< \c true if edge is a bound of the bounding polygon of the cell.
    double kappa;          //!< Hook's coefficient for the elastic spring [newton/meter].
    QPointF pos;           //!< Initial position of the edge's center.

    /* Calculatable */
    double fContract;      //!< Contractile force of the edge [newton].
    double sigma;          //!< Substrate stiffness under edge [newton/meter^2].
    double previousLength; //!< Edge length on the previous iteration [meter].
};

#endif // EDGE_H
